import com.atguigu.mybatis.test.mapper.UserMapper;
import com.atguigu.mybatis.test.pojo.User;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import utils.SqlSessionUtil;

import java.io.IOException;

/**
 * @author Yancy xiao
 * @create 2022-11-09 14:15
 */
public class test {
    @Test
    public void testGetUserByUsername() throws IOException {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        User user = mapper.getUserByUsername("admin");
        System.out.println(user);
    }

    @Test
    public void testinsertUser() throws IOException {
        SqlSession sqlSession = SqlSessionUtil.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        mapper.insertUser(new User(null, "root", "12345", 33, "女", "123@qq.com"));
    }
}
